package org.example.ch02.p26;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int hours=sc.nextInt();
        int money=0;
        if (hours<=120&&hours>=0){
            money=hours*20;
        }else if (hours>120){
            money=(20*120)+((hours-120)*40);
        }
        System.out.println(money);
        sc.close();
    }
}
